package vow.gui.renderer;

import java.awt.Color;
import java.awt.Component;

import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

import econtract.simple.Contract;

public class ContractEntryRenderer extends JLabel implements ListCellRenderer{

	public ContractEntryRenderer(){
		setOpaque(true);
        setHorizontalAlignment(CENTER);
        setVerticalAlignment(CENTER);
        setBackground(Color.LIGHT_GRAY);
	}
	
	@Override
	public Component getListCellRendererComponent(JList list, Object value,
			int index, boolean isSelected, boolean cellHasFocus) {
		if(isSelected){
            setBackground(Color.cyan);
        }
        else
            setBackground(Color.LIGHT_GRAY);
		Contract c = (Contract) value;
        setText(c.getHeader().getId());
        return this;
	}
	
}
